package day03;

import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.List;

public class Demo02 {
    public static void main(String[] args) {
        List<String> list = (List) Proxy.newProxyInstance(
                Demo02.class.getClassLoader(),
                new Class[]{List.class},
                new ProxyListHandler<String>(new ArrayList<>())
        );
        list.add("Tom");
        list.add("Jerry");
        System.out.println(list.size());
        System.out.println(list);
    }
}
